import wx from 'wx'
function toast (msg, types, duration) {
  msg = msg || '';
  types = types || 'fail';
  duration = duration || 1000;
  switch (types) {
    case 'success':// 成功
      wx.showToast({title: msg, icon: 'success', duration: duration});
      break;
    case 'fail':// 失败
      wx.showToast({ title: msg, icon: 'fail', image: '/static/imgs/toast_fail.png', duration: duration });
      break;
    case 'noicon':// 失败无icon
      wx.showToast({ title: msg, icon: 'none', duration: duration });
      break;
    case 'loading':// 正在加载
      wx.showToast({ title: msg, icon: 'loading', duration: duration });
      break;
  }
}

export default toast
